﻿using Dreamwork.Core.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;

namespace dreamwork.core.Extensions
{
	public static class ModelExtensions
	{
		public static IEnumerable<string> GetMemberNames<T>(this T thisValue) where T : IDataModel
		{
			return thisValue.GetType().GetProperties().OrderBy(x => x.Name)?.Select(x => x.Name);
		}
		public static IEnumerable<object> GetMemberValues<TIn>(this TIn thisValue) where TIn : IDataModel
		{
			return thisValue.GetType().GetProperties().OrderBy(x=>x.Name)?.Select(x => x.GetValue(thisValue));
		}
	}
}
